<%@page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@page import="org.jpass.dc.business.admin.bean.AdminBean"%>
<%
AdminBean admin = (AdminBean) request.getAttribute("admin");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>修改个人密码</title>
<script type="text/javascript" src="/daycodefront/lib/extjs/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="/daycodefront/lib/extjs/ext-all-debug.js"></script>
<script type="text/javascript" src="/daycodefront/lib/extjs/src/locale/ext-lang-zh_CN.js"></script>
<script type="text/javascript" src="/daycodefront/common/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="msgBox.js"></script>
<script type="text/javascript">

	/**确定按钮**/
	function updateMyPass() {
		var form = document.forms['updateMyPassForm'];
		var passwordFormat = "[a-zA-Z0-9]{6,18}$";
		var oldPasswordValue = form.oldPassword.value;
		var passwordValue = form.password.value;
		var rePasswordValue = form.rePassword.value;
		if(!passwordValue.match(passwordFormat)){
			alert("密码为6-18位的字母或数字组成！");
			return false;
		}else if(passwordValue!=rePasswordValue){
			alert("两次密码输入不一样！");
			return false;
		}
		Ext.Ajax.request({
		    url : "updateMyPass",
		    method : 'POST',
		    params : {
		    	"id" : form.id.value,
		    	"oldPassword" : form.oldPassword.value,
		    	"password" : form.password.value
		    },
		    success : function(response, options){
			    var res = Ext.util.JSON.decode(response.responseText);
			    if(res.success){// 判断请求是否成功
			    	window.parent.frames.refresh();
			    	window.parent.frames.msgBox_close();
			    } else {
			    	alert(res.msg);
			    }
		    },
		    failure : function(response, options){
		    }
	    });
	}

</script>
<style type="text/css">
* { margin: 0px; padding: 0px; }
table { font: 14px 'Microsoft YaHei', '微软雅黑'; }
table tr { height: 40px; }
table tr td input { height: 23px; }
.title { text-align:right;  }
.content{ width:500px;}
</style>
</head>
<body>
	<div class="content">
		<form action="updateMyPass" name="updateMyPassForm">
		<input type="hidden" name="id" value="<%=admin.getId()%>"/>
			<table width="100%" border="0">
				<tr>
					<td width="20%" class="title">原密码：</td>
					<td><input type="password" name="oldPassword"/>
					</td>
				</tr>
				<tr>
					<td width="20%" class="title">新密码：</td>
					<td><input type="password" name="password"/>
					</td>
				</tr>
				<tr>
					<td class="title">确认密码：</td>
					<td><input type="password" name="rePassword"/>
					</td>
				</tr>
			</table>
		</form>
	</div>
</body>
</html>
